package ie.dcu.spca.data.db;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import ie.dcu.spca.data.BasicDataManager;
import ie.dcu.spca.model.Bean;

public abstract class DBBasicDataManager implements BasicDataManager {

    @Override
    public List<Map<String, Object>> getIdNameMapList() {
        return getIdNameMapList(getBeanList());
    }

    @Override
    public List<Map<String, Object>> getIdNameMapList(List<Bean> beanList) {
        List<Map<String, Object>> beanML = new LinkedList<Map<String, Object>>();
        for (Bean b : beanList) {
            Map<String, Object> beanM = new HashMap<String, Object>();
            beanM.put(ID, getId(b));
            beanM.put(NAME, getName(b));
            beanML.add(beanM);
        }
        return beanML;
    }

    protected static long now() {
        return System.currentTimeMillis();
    }

}
